import Vue from 'vue'
import Router from 'vue-router'
import home from '../components/home.vue'
import foodlist from '../page/foodlist'
import addfood from '../page/addfood'
import login from '../components/login.vue'
import adminList from '../page/adminlist.vue'
import userlist from '../page/userlist'
import homePage from '../page/homePage'
import shoplist from '../page/shoplist'
import addshop from '../page/addshop'
import orderlist from '../page/orderlist.vue'
import edit from '../page/edit.vue'
import pie from '../page/pie.vue'
Vue.use(Router)
// eslint-disable-next-line no-irregular-whitespace
// const login = r => require.ensure([], () => r(require('../page/login')), 'login')
const routes = [
  { path: '/', component: login },
  {
    path: '/home',
    component: home,
    children: [
      {
        path: 'addfood',
        component: addfood,
        meta: ["数据添加", "添加食品"]
      },
      {
        path: 'shoplist',
        component: shoplist,
        meta: ["数据添加", "商铺列表"]
      },
      {
        path: 'addfood',
        component: addfood,
        meta: ["数据添加", "添加食品"]
      },
      {
        path: 'addshop',
        component: addshop,
        meta: ["数据管理", "添加商铺"]
      },
      {
        path: 'adminlist',
        component: adminList,
        meta: ["数据管理", "管理员列表"]
      },
    {
      path: '/home/userlist',
      component: userlist,
      meta: ['数据管理', '用户列表']
    },
      {
      path: '',
      component: homePage,
     },
      {
        path: '/home/orderlist',
        component: orderlist,
        meta: ['数据管理', '订单列表']
      },
      {
        path: '/home/edit',
        component: edit,
        meta: ['数据管理', '文本编辑']
      },
      {
        path: '/home/pie',
        component: pie,
        meta: ['数据管理', '用户分布']
      }
    ]
  }
]
export default new Router({
  routes
})
